<%--
  Created by IntelliJ IDEA.
  User: 旧人
  Date: 2019/2/15
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="/resources/jquery/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" href="/resources/layui/css/layui.css">
    <script type="text/javascript" src="/resources/layui/layui.js"></script>

    <link rel="stylesheet" href="/resources/layui/css/style.css">

    <script type="text/javascript" src="/resources/js/vip/vip_comm.js"></script>
    <script  type="text/javascript">
               // $(document).ready(function(){
               //     $("#username").focus();
               // });
        var hadoop = function(){
            // 异步验证用户是否重复
            if($.trim($("#username").val())==""){
                $("#message").html("用户名不能为空");
                // $("#username").focus();

            }else{
                $("#message").html("");

                $.ajax({
                    type: "post",
                    url: "abc",
                    data: "username=" + $("#username").val(),
                    dataType:"json",
                    success: function(data){
                        if(data.userId!=null){
                            $("#message").html("用户正确");
                        }else{
                            $("#message").html("用户不存在");
                        }
                    },
                    error:function (data) {

                        // var a = prompt("w");
                        // alert(a);
                        //alert("请求失败！");
                        $("#message").html(data.nei);

                    }
                });
            }
        };
    </script>
    <%--<script>--%>
        <%--var p1 = {name:"tom","my age":12};--%>
        <%--function person(name,age) {--%>
            <%--this.name=name;--%>
            <%--this.age=age;--%>
        <%--}--%>
        <%--var p2=new person("javal",15);--%>

        <%--var age = p2.age;--%>
        <%--alert(age);--%>
        <%--age = p1["my age"];--%>
        <%--alert(age);--%>

    <%--</script>--%>

    <script>
        // $(document).ready(function () {
        //     $("#message1").html("wew");
        // });
        window.onload=function (ev) {
            $("#message1").html("wew");
        }
    </script>

</head>
<body>

<div id="body">
    <form action="#" method="post">
        <table>
            <tr>
                <td>用户名：</td><td><input type="text" id="username" name="username" onblur="hadoop()" /></td>
                <td><em id="message"></em></td>
                <td><em id="message1"></em></td>
            </tr>


        </table>
    </form>
</div>

<%--<script type="text/javascript">--%>
    <%--myWindow=window.open('','','width=200,height=100')--%>
    <%--myWindow.document.write("This is 'myWindow'")--%>
    <%--myWindow.focus()--%>
<%--</script>--%>


</body>
</html>
